/**
 * 
 * Copyright (C) 2015 by Elcom Software Company
 *
 * @id: DBCmd.java, Feb 5, 2015
 *
 */
package com.nip.commons.dbcp.cmd;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.nip.commons.dbcp.interf.IDBCmd;

/**
 * @author ThangNM<thangnm@elcom.com.vn>
 *
 * @version v
 */
public abstract class DBCmd implements IDBCmd {

    protected void close(ResultSet rs)
    {
        if(rs == null)
        {
            return;
        }
        
        try {
            rs.close();
        } catch (SQLException e) {
        }
    }
    
    protected void close(CallableStatement cst)
    {
        if(cst == null)
        {
            return;
        }
        
        try {
            cst.close();
        } catch (SQLException e) {
        }
    }
    
    protected void close(Statement stm)
    {
        if(stm == null)
        {
            return;
        }
        
        try {
            stm.close();
        } catch (SQLException e) {
        }
    }
    
    protected void close(Connection conn)
    {
        if(conn == null)
        {
            return;
        }
        
        try {
            conn.close();
        } catch (SQLException e) {
        }
    }
    
}
